<template>
  <div style="min-height: 300px; border-bottom: 1px solid rgb(240, 240, 240); margin-bottom: 20px">
    <div class="list_th">
      <a-row style="display: flex; aligin-item: center">
        <a-col style="padding-left: 16px; margin-right: 16px; display: block; float: left">
          <a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange"
        /></a-col>
        <a-col
          v-for="(item, index) in list_th"
          :key="index"
          :span="item.span"
          :style="[{ marginRight: '16px' }, { width: index == 0 ? '260px' : '' }, { flex: index != 0 ? '1' : '' }]"
          >{{ item.title }}
        </a-col>
      </a-row>
    </div>
    <a-empty :image="simpleImage" v-show="!pagaData.length" />
    <div class="list_li" v-for="(item, index) in pagaData" :key="index">
      <a-row class="row_head">
        <a-col style="padding-left: 16px; margin-right: 16px"> <a-checkbox v-model="item.is_checked" /></a-col>
        <a-col span="23" style="display: flex; justify-content: space-between; padding-right: 20px">
          <div>
            <a-icon
              :type="item.order_origin == 0 ? 'link' : item.order_origin == 1 ? 'alipay' : 'mobile'"
              style="margin-right: 4px; color: rgba(0, 0, 0, 0.65); font-size: 14px"
            />
            <template v-if="item.food_table_num">
              <span class="order-num" style="margin-right: 20px">餐桌号 {{ item.food_table_num }}</span>
            </template>
            <a-tooltip>
              <template slot="title"> 双击复制 </template>
              <span class="order-num" @dblclick="copyText(item.order_no)">订单号：{{ item.order_no }}</span>
            </a-tooltip>
            <span class="userInfo"><img :src="item.avatar" /> {{ item.nickname }}</span>

            <template v-if="item.is_cloud_bind">
              <template v-if="item.order_transit_id === '0'">
                <a-tooltip v-if="parseInt(item.trans_status) === 2">
                  <template slot="title"> {{ item.trans_error }} </template>
                  <a-button
                    type="link"
                    style="margin-left: 20px"
                    @click="$emit('triggerAction', 'transOrderSupplier', item)"
                  >
                    转单异常（再次提交）
                  </a-button>
                </a-tooltip>

                <a-button v-else-if="parseInt(item.trans_status) === 1"> 转单完成 </a-button>
                <a-button
                  v-else
                  type="link"
                  style="margin-left: 20px"
                  @click="$emit('triggerAction', 'transOrderSupplier', item)"
                  >可转单</a-button
                >
              </template>
              <template v-else>
                <a-button
                  type="link"
                  @click="$emit('triggerAction', 'see', item)"
                  class="disabled"
                  style="margin-left: 20px"
                  >已转单</a-button
                >
              </template>
            </template>

            <span style="margin-left: 20px; color: #333" v-if="parseInt(item.activity_cut_price_order_id)"
              >砍价-订单id：{{ parseInt(item.activity_cut_price_order_id) }}</span
            >
            <span style="margin-left: 20px; color: #333" v-if="parseInt(item.pt_order_id)"
              >拼团-订单id：{{ parseInt(item.pt_order_id) }}</span
            >
          </div>
        </a-col>
      </a-row>
      <a-row class="row_goods">
        <a-col style="padding-left: 16px; margin-right: 16px">
          <a-icon
            :type="item.is_open ? 'minus-square' : 'plus-square'"
            class="plusIcon"
            @click="openItem(item)"
            v-show="item.goods_list && item.goods_list.length != 1"
          ></a-icon
        ></a-col>
        <a-col
          v-for="(inner, index) in list_th"
          :key="index"
          :style="[{ marginRight: '16px' }, { width: index == 0 ? '277px' : '' }, { flex: index == 0 ? '' : '1' }]"
          :span="inner.span"
        >
          <!-- 产品名称 -->
          <div v-if="inner.title == '商品信息'">
            <!-- <a-row v-if="inner.type == 'refundList'" style="margin-top: 6px;">
              <a-col span="6">
                <img
                  :src="item.goods_pic || 'https://cyy-desc.oss-cn-beijing.aliyuncs.com/sp210329_163447.png'"
                  style="width: 80%; border-radius: 5px"
                />
              </a-col>
              <a-col span="18">
                <a-tooltip>
                  <template slot="title">
                    {{ item.goods_name }}
                  </template>
                  <h4 class="over_e fw_b">{{ item.goods_name }}</h4>
                </a-tooltip>
                <a-tooltip>
                  <template slot="title">
                    {{ item.attr ? item.attr.map((e) => e.attr_name).join() || '默认' : '默认' }}
                  </template>
                  <div class="over_e">
                    规格：{{ item.attr ? item.attr.map((e) => e.attr_name).join() || '默认' : '默认' }}
                  </div>
                </a-tooltip>
              </a-col>
            </a-row> -->
            <a-row
              :gutter="10"
              v-for="(el, inx) in item.is_open ? item.goods_list : [item.goods_list ? item.goods_list[0] : {}]"
              :key="inx"
              style="margin: 14px 0"
            >
              <img
                :src="el.goods_pic || el.pic || 'https://cyy-desc.oss-cn-beijing.aliyuncs.com/sp210329_163447.png'"
                style="width: 48px; height: 48px; border-radius: 4px; margin-right: 16px; display: block"
              />
              <a-col span="18" style="padding: 0; width: auto">
                <a-tooltip>
                  <template slot="title">
                    {{ el.name }}
                  </template>
                  <h4 class="over_e fw_b">{{ el.name }}</h4>
                </a-tooltip>
                <a-tooltip v-if="item.wge">
                  <template slot="title">
                    {{ item.wge.desc }}
                  </template>
                  <div class="over_e">
                    {{ item.wge.desc }}
                  </div>
                </a-tooltip>
                <!-- <a-tooltip v-else-if="item.order_type == 1">
                  <div class="over_e">
                    预约时间：{{item.book.date}}
                  </div>
                </a-tooltip>
                <a-tooltip v-else>
                  <div class="over_e">
                    预约时间：{{item.book.date}}
                  </div>
                </a-tooltip> -->
              </a-col>
            </a-row>
          </div>
          <!-- 单价数量 -->
          <div v-if="inner.title == '单价/数量'">
            <div
              v-for="(el, inx) in item.is_open ? item.goods_list : [item.goods_list ? item.goods_list[0] : {}]"
              :key="inx"
              style="margin: 14px 0"
            >
              <div>小计：{{ el.total_price }}元</div>
              <div>数量：{{ el.num }}{{ el.unit }}</div>
            </div>
          </div>
          <!-- 运费 -->
          <div v-if="inner.title == '运费/优惠'">
            <div v-show="inner.type == 'list' || inner.type == 'offlineList'">
              <div>运费：{{ item.express_price }}元</div>
              <p style="margin-bottom: 0">
                <!-- <span>使用{{ item.integral.forehead_integral }}积分</span> -->
                <!-- &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; -->
                <!-- <span>优惠金额：{{ item.integral.forehead || 0 }}元</span> -->
                <span>优惠金额：{{ item.all_discount || 0 }}元</span>
              </p>
            </div>
            <!-- <div v-show="inner.type == 'delivery'">
              <div>运费：0.45元</div>
              <div>会员折扣：9.00折</div>
            </div> -->
          </div>
          <!-- 订单金额 -->
          <div v-if="inner.title == '订单金额'">
            <!-- <div>总金额:{{ item.total_price }}元</div> -->
            <div>应付款:{{ item.pay_price }}元</div>
            <div>实际支付:{{ item.pay_price }}元</div>
          </div>
          <!-- 订单状态 -->
          <div v-if="inner.title == '订单状态/服务状态'">
            <div v-if="inner.type == 'refundList'">
              <template v-if="item.refund_status == 0">
                <template v-if="item.is_agree == 1">
                  <template v-if="item.is_user_send == 1">
                    用户已发货
                    <div>快递公司：{{ item.user_send_express }}</div>
                    <div>快递单号：{{ item.user_send_express_no }}</div>
                  </template>
                  <template v-else> 待用户发货 </template>
                </template>
                <template v-else> 待处理 </template>
              </template>
              <template v-else-if="item.refund_status == 1"> 已同意退款退货 </template>
              <template v-else-if="item.refund_status == 2"> 已同意换货 </template>
              <template v-else-if="item.refund_status == 3">
                {{ item.refund_type == 1 ? '已拒绝退货退款' : '已拒换货' }}
                <br />
                <div>{{ item.refund_refuse_desc }}</div>
              </template>
              <template v-if="item.pay_type == 2"> 注：货到付款方式的退款需要线下与客户自行协商 </template>
            </div>
            <div v-else>
              <div class="status">
                <div class="flex-y-center">
                  <span class="dian" :style="item | orderStatus"></span>
                  <span>{{ item | orderStatusFormate }}{{ item.refund == undefined ? '' : '（有售后）' }}</span>
                </div>
                <div class="flex-y-center">
                  <span class="dian" :style="item | orderStatus"></span>
                  <span>{{ item | extStatus }}{{ item.refund == undefined ? '' : '（有售后）' }}</span>
                </div>
              </div>
            </div>
          </div>
          <!-- 订单来源 -->
          <div v-if="inner.title == '订单来源'">
            <div v-if="inner.type == 'refundList'">
              <template v-if="item.platform == 0"> 微信用户 </template>
              <template v-if="item.platform == 1"> 支付宝 </template>
              <template v-if="item.platform == 2"> 公众号 </template>
              <template v-if="item.platform == 3"> APP </template>
            </div>
            <div v-else>{{ item.order_origin | orderOriginFormate }}</div>
          </div>
          <!-- 退款退货/换货 -->
          <div v-if="inner.title == '售后类型'">
            <div>{{ item.refund_type == 1 ? '退款退货' : '换货' }}</div>
          </div>
          <!-- 退款金额 -->
          <div v-if="inner.title == '退款金额'">
            <div>{{ item.refund_price }}元</div>
          </div>
          <!-- 申请理由 -->
          <div v-if="inner.title == '申请理由'">
            <div>{{ item.refund_desc }}</div>
          </div>
          <!-- 实际付款 -->
          <div v-if="inner.title == '实际付款'">
            <div>1299.45元</div>
          </div>
          <!-- 发货方式 -->
          <div v-if="inner.title == '发货方式'">
            <div>快递配送</div>
          </div>
          <!-- 配送状态 -->
          <div v-if="inner.title == '配送状态'">
            <div>已配送</div>
          </div>
          <!-- 配送员 -->
          <div v-if="inner.title == '配送员'">
            <div>无</div>
          </div>
          <!-- 分销情况 -->
          <div v-if="inner.title == '分销情况'">
            <a-row v-if="item.share_1 || item.share_2 || item.share_3">
              <a-col v-if="item.share_1" :span="item.share_2 ? (item.share_3 ? 8 : 12) : 24">
                <div>
                  <div v-if="item.share_1.nickname">昵称：{{ item.share_1.nickname }}</div>
                  <div v-if="item.share_1.name">姓名：{{ item.share_1.name }}</div>
                  <div v-if="item.share_1.mobile">电话：{{ item.share_1.mobile }}</div>
                  <div>一级佣金：{{ item.first_price }}</div>
                </div>
              </a-col>
              <a-col v-if="item.share_2" :span="item.share_3 ? 8 : 12">
                <div>
                  <div v-if="item.share_2.nickname">昵称：{{ item.share_2.nickname }}</div>
                  <div v-if="item.share_2.name">姓名：{{ item.share_2.name }}</div>
                  <div v-if="item.share_2.mobile">电话：{{ item.share_2.mobile }}</div>
                  <div>二级佣金：{{ item.second_price }}</div>
                </div>
              </a-col>
              <a-col v-if="item.share_3" :span="8">
                <div>
                  <div v-if="item.share_3.nickname">昵称：{{ item.share_3.nickname }}</div>
                  <div v-if="item.share_3.name">姓名：{{ item.share_3.name }}</div>
                  <div v-if="item.share_3.mobile">电话：{{ item.share_3.mobile }}</div>
                  <div>三级佣金：{{ item.third_price }}</div>
                </div>
              </a-col>
            </a-row>
            <div v-else>
              自购返利<span style="color: red">{{ item.rebate }}</span
              >元
            </div>
          </div>
          <!-- 服务分销佣金 -->
          <div v-if="inner.title == '服务分销佣金'">
            <span style="color: red">{{ item.woe ? item.woe.worker_price || '0.00' : '0.00' }}</span>
            元
          </div>
          <!-- 操作人 -->
          <div v-if="inner.title == '操作人'">
            {{ item.op_admin_name }}
          </div>
          <!-- 操作 -->
          <div v-if="inner.title == '操作'" class="row_actions">
            <div v-if="inner.type == 'refundList'">
              <template v-if="item.is_user_cancel == 0">
                <template v-if="item.refund_status == 0">
                  <template v-if="item.refund_type == 1">
                    <template v-if="item.is_agree == 1">
                      <template v-if="item.is_user_send != 1">
                        <a-button
                          type="link"
                          v-if="inner.actions.find((sm) => sm == '拒绝退货')"
                          @click="$emit('triggerAction', 'disagree_2', item)"
                        >
                          拒绝退货
                        </a-button>
                        <a-divider type="vertical" />
                      </template>
                      <a-button
                        type="link"
                        v-if="inner.actions.find((sm) => sm == '确认收货')"
                        @click="$emit('triggerAction', 'agree_3', item)"
                      >
                        确认收货
                      </a-button>
                    </template>
                    <template v-else>
                      <a-button
                        type="link"
                        v-if="inner.actions.find((sm) => sm == '同意退货')"
                        @click="$emit('triggerAction', 'agree_2', item)"
                      >
                        同意退货
                      </a-button>
                      <a-divider type="vertical" v-if="inner.actions.find((sm) => sm == '同意退货')" />
                      <a-button
                        type="link"
                        v-if="inner.actions.find((sm) => sm == '拒绝退货')"
                        @click="$emit('triggerAction', 'disagree_2', item)"
                      >
                        拒绝退货
                      </a-button>
                      <a-divider type="vertical" v-if="inner.actions.find((sm) => sm == '拒绝退货')" />
                      <a-button type="link" @click="$emit('triggerAction', 'refund', item)"> 退款 </a-button>
                    </template>
                  </template>
                  <template v-else>
                    <a-button
                      type="link"
                      v-if="inner.actions.find((sm) => sm == '同意换货')"
                      @click="$emit('triggerAction', 'agree_1', item)"
                    >
                      同意换货
                    </a-button>
                    <a-divider type="vertical" v-if="inner.actions.find((sm) => sm == '同意换货')" />
                    <a-button
                      type="link"
                      v-if="inner.actions.find((sm) => sm == '拒绝换货')"
                      @click="$emit('triggerAction', 'disagree_1', item)"
                    >
                      拒绝换货
                    </a-button>
                  </template>
                </template>
              </template>
              <template v-else> 用户取消售后申请 </template>
            </div>
            <div v-else>
              <a-button
                type="link"
                v-if="inner.actions.find((sm) => sm == '改价') && item.is_pay === '0'"
                @click="$emit('triggerAction', 'change_price', item)"
              >
                改价
              </a-button>
              <a-button type="link" v-if="item.woe.status_ext == '10'" @click="$emit('onFenpei', item)">
                分配
              </a-button>

              <template v-if="item.md_id > 0">
                <a-button
                  type="link"
                  v-if="item.apply_delete == 1 && list_th[0].type != 'shareOrder' && item.trade_status != 1"
                  @click="$emit('triggerAction', 'order_cancel_1', item, '')"
                  :disabled="item.is_trans != 1"
                  >同意</a-button
                >

                <a-button
                  type="link"
                  v-if="
                    inner.actions.find((sm) => sm == '发货') &&
                    item.apply_delete != 1 &&
                    (item.trade_status == 0 || (item.pay_type == 2 && item.trade_status == -1)) &&
                    item.is_delete == 0 &&
                    !item.delivery_id
                  "
                  @click="$emit('triggerAction', 'order_send', item)"
                >
                  发货
                </a-button>
                <a-button
                  type="link"
                  v-if="
                    inner.actions.find((sm) => sm == '核销') &&
                    (item.is_pay == 1 || item.pay_type == 2) &&
                    item.apply_delete != 1 &&
                    item.is_offline == 1 &&
                    item.trade_status == 2 &&
                    item.is_delete == 0
                  "
                  @click="$emit('triggerAction', 'order_cancel_verification', item)"
                  :disabled="item.clerk_id > 0"
                >
                  核销
                </a-button>
                <a-button
                  type="link"
                  v-if="inner.actions.find((sm) => sm == '确认收货') && item.pay_type == 2 && item.trade_status == 2"
                  @click="$emit('triggerAction', 'order_confirm', item)"
                  :disabled="item.is_trans != 1"
                >
                  收货
                </a-button>
                <!-- && item.trade_status != 0 -->
                <a-divider type="vertical" />
                <a-button
                  type="link"
                  @click="$emit('triggerAction', 'order_edit', item)"
                  v-if="inner.actions.find((sm) => sm == '编辑') && item.pay_type != 2"
                >
                  详情
                </a-button>
                <a-divider type="vertical" />
                <a-dropdown v-if="inner.actions.length" :disabled="item.is_trans != 1">
                  <a-button type="link"> 更多 <a-icon type="down" /> </a-button>
                  <a-menu slot="overlay">
                    <a-menu-item
                      v-if="
                        inner.actions.find((sm) => sm == '发货') &&
                        item.apply_delete == 1 &&
                        (item.trade_status == 0 || (item.pay_type == 2 && item.trade_status == -1)) &&
                        item.is_delete == 0 &&
                        !item.delivery_id
                      "
                      :disabled="item.is_trans != 1"
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_send', item)"> 发货 </a>
                    </a-menu-item>
                    <a-menu-item
                      type="link"
                      v-if="
                        inner.actions.find((sm) => sm == '核销') &&
                        (item.is_pay == 1 || item.pay_type == 2) &&
                        item.apply_delete == 1 &&
                        item.is_offline == 1 &&
                        item.trade_status < 1 &&
                        item.is_delete == 0
                      "
                      :disabled="item.is_trans != 1 || item.clerk_id > 0"
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_cancel_verification', item)">
                        核销
                      </a>
                    </a-menu-item>
                    <a-menu-item
                      v-if="inner.actions.find((sm) => sm == '取消') && item.trade_status < 1 && item.is_delete == 0"
                    >
                      <!-- <a-popconfirm placement="left" @confirm="$emit('triggerAction', 'order_cancel', item, reason)">
                        <template slot="title">
                          <p>确认取消该订单吗？</p>
                          <a-input v-model="reason" placeholder="请输入取消原因" />
                        </template>
                        <a href="javascript:;"> 取消 </a>
                      </a-popconfirm> -->
                      <!-- 456456 -->
                      <a href="javascript:;" @click="cancel(item)">取消</a>
                    </a-menu-item>
                    <a-menu-item
                      v-if="
                        inner.actions.find((sm) => sm == '编辑') &&
                        (item.trade_status == 0 || (item.trade_status == -1 && item.pay_type == 2))
                      "
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_edit', item)"> 详情 </a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '订单打印')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_print', item)">订单打印</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '小票打印')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_receipts_print', item)">小票打印</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '添加备注')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_remark', item)">添加备注</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '移入回收站')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_recycle', item)">移入回收站</a>
                    </a-menu-item>
                    <!-- <a-menu-item>
                      <a href="javascript:;" @click="logisticsInfo(item)">物流信息</a>
                    </a-menu-item> -->
                  </a-menu>
                </a-dropdown>
              </template>
              <template v-else>
                <a-button
                  type="link"
                  v-if="item.apply_delete == 1 && list_th[0].type != 'shareOrder' && item.trade_status != 1"
                  @click="$emit('triggerAction', 'order_cancel_1', item, '')"
                >
                  同意
                </a-button>
                <a-button
                  type="link"
                  v-if="item.apply_delete == 1 && list_th[0].type != 'shareOrder' && item.trade_status != 1"
                  @click="$emit('triggerAction', 'order_cancel_2', item, '')"
                >
                  拒绝
                </a-button>

                <a-button
                  type="link"
                  v-if="inner.actions.find((sm) => sm == '确认付款') && item.woe && item.woe.status_ext == 5"
                  @click="$emit('triggerAction', 'order_confirm_pay', item)"
                >
                  确认付款
                </a-button>
                <a-button
                  type="link"
                  v-if="
                    inner.actions.find((sm) => sm == '确认付款') &&
                    item.is_pay == 1 &&
                    item.woe &&
                    [10, 15, 20, 30, 40, 50].some((v) => v == item.woe.status_ext)
                  "
                  @click="$emit('triggerAction', 'order_confirm_receipt', item)"
                >
                  确认收货
                </a-button>
                <a-button
                  type="link"
                  v-if="
                    inner.actions.find((sm) => sm == '核销') &&
                    (item.is_pay == 1 || item.pay_type == 2) &&
                    item.is_offline == 1 &&
                    item.apply_delete != 1 &&
                    item.trade_status < 1 &&
                    item.is_delete == 0
                  "
                  @click="$emit('triggerAction', 'order_cancel_verification', item)"
                  :disabled="item.clerk_id > 0"
                >
                  核销
                </a-button>
                <a-button
                  type="link"
                  v-if="inner.actions.find((sm) => sm == '确认收货') && item.pay_type == 2 && item.trade_status == 2"
                  @click="$emit('triggerAction', 'order_confirm', item)"
                >
                  收货
                </a-button>
                <a-button
                  type="link"
                  v-if="inner.actions.find((sm) => sm == '编辑') && item.trade_status != 0 && item.pay_type != 2"
                  @click="$emit('triggerAction', 'order_edit', item)"
                >
                  详情
                </a-button>
                <a-dropdown v-if="inner.actions.length">
                  <a-button type="link"> 更多 <a-icon type="down" /> </a-button>
                  <a-menu slot="overlay">
                    <a-menu-item
                      v-if="
                        inner.actions.find((sm) => sm == '发货') &&
                        item.apply_delete == 1 &&
                        (item.trade_status == 0 || (item.pay_type == 2 && item.trade_status == -1)) &&
                        item.is_delete == 0 &&
                        item.is_offline != 1 &&
                        !item.delivery_id
                      "
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_send', item)">发货</a>
                    </a-menu-item>
                    <a-menu-item
                      type="link"
                      v-if="
                        inner.actions.find((sm) => sm == '核销') &&
                        (item.is_pay == 1 || item.pay_type == 2) &&
                        item.is_offline == 1 &&
                        item.apply_delete == 1 &&
                        item.trade_status < 1 &&
                        item.is_delete == 0 &&
                        !item.clerk_id
                      "
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_cancel_verification', item)">核销</a>
                    </a-menu-item>
                    <a-menu-item
                      v-if="inner.actions.find((sm) => sm == '取消') && item.trade_status < 1 && item.is_delete == 0"
                    >
                      <!-- <a-popconfirm placement="left" @confirm="$emit('triggerAction', 'order_cancel', item, reason)">
                        <template slot="title">
                          <p>确认取消该订单吗？</p>
                          <a-input v-model="reason" placeholder="请输入取消原因" />
                        </template>
                        <a href="javascript:;"> 取消 </a>
                      </a-popconfirm> -->
                      <a href="javascript:;" @click="cancel(item)">取消</a>
                    </a-menu-item>
                    <a-menu-item
                      v-if="
                        inner.actions.find((sm) => sm == '编辑') &&
                        (item.trade_status == 0 || (item.trade_status == -1 && item.pay_type == 2))
                      "
                    >
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_edit', item)"> 详情 </a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '订单打印')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_print', item)">订单打印</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '小票打印')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_receipts_print', item)">小票打印</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '添加备注')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_remark', item)">添加备注</a>
                    </a-menu-item>
                    <a-menu-item v-if="inner.actions.find((sm) => sm == '移入回收站')">
                      <a href="javascript:;" @click="$emit('triggerAction', 'order_recycle', item)">移入回收站</a>
                    </a-menu-item>
                    <!-- <a-menu-item>
                      <a href="javascript:;" @click="logisticsInfo(item)">物流信息</a>
                    </a-menu-item> -->
                    <!-- <a-menu-item v-if="item.is_pay == 1 && item.trade_status == 2">
                      <a href="javascript:;" @click="$emit('triggerAction', 'change_modifyLog', item)">修改物流</a>
                    </a-menu-item> -->
                  </a-menu>
                </a-dropdown>
              </template>
            </div>
          </div>
          <!-- 买家/收货人 -->
          <div v-if="inner.title == '买家/收货人'">
            <a-tooltip
              v-for="(el, inx) in item.is_open
                ? item.goods_list
                  ? [item.goods_list[0]]
                  : []
                : [item.goods_list ? item.goods_list[0] : {}]"
              :key="inx"
              overlayClassName="draw_overlay"
              :overlayStyle="{
                width: '250px',
              }"
            >
              <template slot="title">
                <div class="addressInfo">
                  <div v-if="item.order_type === '1' && item.book_info && item.book_info.length">
                    <h3>入住人</h3>
                    <div v-for="(e, i) of item.book_info" :key="i">
                      <h4>姓名：{{ e.name }}</h4>
                      <h4>手机：{{ e.mobile }}</h4>
                      <h4>身份证：{{ e.idCard }}</h4>
                    </div>
                  </div>
                  <div v-else>
                    <h3>收货人</h3>
                    <h4>姓名：{{ item.name || item.user_name }}</h4>
                    <h4>手机：{{ item.mobile || item.user_mobile }}</h4>
                    <h4>地址：{{ item.address || item.user_address }}</h4>
                    <h4 v-if="item.order_type == 3">取餐码:{{ item.food_code }}</h4>
                  </div>
                </div>
              </template>

              <div class="delivery_type">
                <span>{{ item.user_name }}</span>
                <span>{{ el.delivery_type == 0 ? '上门服务' : el.delivery_type == 1 ? '商店自提' : '同城配送' }}</span>
                <span v-if="item.order_type == 3 && item.food_book_ext && item.food_book_ext != ''">
                  {{ JSON.parse(item.food_book_ext).time }}
                </span>
              </div>
            </a-tooltip>
          </div>
          <!-- 下单门店/时间 -->
          <div v-if="inner.title == '服务人员/时间'">
            <div class="md_info" v-if="item.w">
              <span>{{ item.w.name }}</span>
              <span>{{ item.created_at }}</span>
            </div>
          </div>
          <!-- 佣金状态/时间 -->
          <div v-if="inner.title == '佣金状态/时间'">
            <div class="cashStatus">
              <span>状态:{{ item.is_price == 0 ? '待入账' : '已入账' }}</span>
              <span
                >到账时间:{{
                  item.confirm_time > 0 ? $moment(item.confirm_time * 1000).format('YYYY-MM-DD HH:mm:ss') : '-'
                }}</span
              >
            </div>
          </div>
        </a-col>
      </a-row>
    </div>

    <a-modal
      title="确认取消该订单吗？"
      :visible="visible"
      :confirm-loading="confirmLoading"
      @ok="handleOk"
      @cancel="visible = false"
    >
      <a-input v-model="reason" placeholder="请输入取消原因" />
    </a-modal>

    <ContentDetails title="物流信息" ref="pop" @cancel="infoItem = null">
      <div class="logisticsInfo" v-if="infoItem">
        <div class="logisticsInfoHd">
          <p>快递名称：{{ infoItem.express }}</p>
          <p>快递单号：{{ infoItem.express_no }}</p>
          <p>状态：{{ infoItem.status_text }}</p>
        </div>

        <a-timeline>
          <a-timeline-item v-for="(item, index) of infoItem.list" :key="index">
            <div class="des">{{ item.detail }}</div>
            <div class="time">{{ item.datetime }}</div>
          </a-timeline-item>
        </a-timeline>
      </div>
    </ContentDetails>
  </div>
</template>

<script>
import { Empty, Timeline } from 'ant-design-vue'
import { getExpressData } from '@/api/order'

export default {
  components: {
    [Timeline.Item.name]: Timeline.Item,
    ContentDetails: () => import('@/components/tools/ContentDetail'),
  },

  props: {
    list_th: {
      type: Array,
      default: () => [],
    },
    pagaData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      reason: '',
      visible: false,
      item: null,
      confirmLoading: false,
      infoItem: null,
    }
  },
  filters: {
    orderTypeFilter(val) {
      switch (val) {
        case '0':
          return '商城订单'
        case '1':
          return '酒店预约'
        case '2':
          return '服务预约'
        default:
          return ''
      }
    },
    orderStatusFormate(val) {
      if (parseInt(val.order_type) === 1) {
        if ([0, 2].includes(parseInt(val.trade_status))) {
          return '待使用'
        }
      }

      if (val.trade_status == 1) {
        return '已取消'
      }
      if (val.is_pay == 0) {
        return '未支付'
      }
      if (val.is_pay == 1 && val.trade_status == 0) {
        return '待发货'
      }
      if (val.is_pay == 1 && val.trade_status == 2) {
        return '待收货'
      }
      if (val.is_pay == 1 && val.trade_status == 3) {
        return '已完成'
      }
    },
    extStatus(val) {
      const statusList = require('../statusList.json')
      return statusList[val.woe.status_ext]
    },
    orderStatus(val) {
      if (val.trade_status == 1) {
        return 'background-color:#c6c6c6;'
      }
      if (val.is_pay == 0) {
        return 'background-color:#c6c6c6;'
      }
      if (val.is_pay == 1 && val.trade_status == 0) {
        return 'background-color:#faad14'
      }
      if (val.is_pay == 1 && val.trade_status == 2) {
        return 'background-color:#1890ff'
      }
      if (val.is_pay == 1 && val.trade_status == 3) {
        return 'background-color:#65c817'
      }
    },
    payTypeFormate(val) {
      switch (val) {
        case '1':
          return '微信支付'
        case '2':
          return '货到付款'
        case '3':
          return '余额'
        case '4':
          return '支付宝'
        default:
          return '未支付'
      }
    },
    orderOriginFormate(val) {
      switch (val) {
        case '1':
          return '公众号或网络'
        case '2':
          return 'app'
        case '3':
          return '小程序'
        default:
          return ''
      }
    },
  },
  computed: {
    mdTimeStatus() {
      return (md) => {
        console.log(md)
        if (parseInt(md.open_status) === 1) {
          return '营业'
        }
        return '打烊'
      }
    },
    mdTime() {
      return (md) => {
        if (parseInt(md.shop_time_type) === 1) {
          return md.start_time + ' - ' + md.end_time
        }
        return '全天营业'
      }
    },
    indeterminate() {
      let len = this.pagaData.filter((item) => item.is_checked).length
      if (len && len != this.pagaData.length) {
        return true
      } else {
        return false
      }
    },
    checkAll() {
      let len = this.pagaData.filter((item) => item.is_checked).length
      if (len == this.pagaData.length && this.pagaData.length != 0) {
        return true
      } else {
        return false
      }
    },
  },
  watch: {},
  beforeCreate() {
    this.simpleImage = Empty.PRESENTED_IMAGE_SIMPLE
  },
  created() {},
  mounted() {},
  updated() {},
  methods: {
    logisticsInfo({ id: order_id }) {
      getExpressData({
        order_id,
      }).then((res) => {
        if (res.code !== 0 || !res.data) {
          this.$message.error(res.msg)
          return
        }
        this.infoItem = res.data
        this.$refs.pop.visible = true
      })
    },

    handleOk() {
      let { item, reason } = this
      this.$emit('triggerAction', 'order_cancel', item, reason)
      this.confirmLoading = true
    },

    cancel(item) {
      this.item = item
      this.visible = true
    },

    onCheckAllChange(e) {
      let len = this.pagaData.filter((item) => item.is_checked).length
      if (len != this.pagaData.length) {
        this.pagaData.forEach((el) => {
          this.$set(el, 'is_checked', true)
        })
      } else {
        this.pagaData.forEach((el) => {
          this.$set(el, 'is_checked', false)
        })
      }
    },
    openItem(item) {
      if (typeof item.is_open == 'undefined') {
        this.$set(item, 'is_open', true)
        return
      }
      this.$set(item, 'is_open', !item.is_open)
    },
    copyText(data) {
      if (!data) return
      this.$copyText(data)
        .then((e) => {
          this.$message.success('复制成功')
        })
        .catch((err) => {
          console.log(err)
          this.$message.error('复制失败')
        })
    },
  },
}
</script>

<style scoped lang="less">
.plusIcon {
  cursor: pointer;
  transition: all 0.5s;
  &:hover {
    color: rgb(24, 144, 255);
  }
}
.fw_b {
  font-weight: bold;
}
.row_footer {
  border-top: 1px solid rgb(240, 240, 240);
  color: rgba(143, 143, 143);
  line-height: 50px;
}
.row_actions {
  display: flex;
  align-items: center;
  /deep/ .ant-btn {
    padding: 0;
    margin-right: 15px;
  }
}
.list_li {
  /deep/.ant-row {
    display: flex;
    align-items: center;
  }
  .row_goods {
    transition: all 0.5s;
  }
  .row_footer {
    transition: all 0.5s;
  }
  &:hover {
    .row_head {
      background: rgb(230, 247, 255);
    }
    .row_goods {
      background: rgb(230, 247, 255);
    }
    .row_footer {
      background: rgb(230, 247, 255);
    }
  }
}
.list_li:hover {
  background: rgb(230, 247, 255);
}
.row_goods {
  padding: 15px 0;
}
.over_e {
  width: 192px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.list_th {
  background: rgb(250, 250, 250);
  height: 50px;
  line-height: 50px;
  color: black;
}
.row_head {
  border-top: 1px solid #e9e9e9;
  height: 53px;
  background: #fafafa;
  color: rgba(143, 143, 143);
  border-bottom: 1px solid #e9e9e9;
  .order-num {
    user-select: none;
    font-size: 14px;
    font-family: SFUIText-Regular;
    color: rgba(0, 0, 0, 0.85);
  }
}
.delivery_type {
  display: flex;
  flex-direction: column;
  font-size: 14px;

  color: rgba(0, 0, 0, 0.85);
  margin: 5px 0;
}
.addressInfo {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #fff;

  h3 {
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.09);
    color: rgba(0, 0, 0, 0.85);
  }

  h4 {
    color: rgba(0, 0, 0, 0.65);
  }
}
.md_info {
  display: flex;
  flex-direction: column;
  font-size: 14px;

  color: rgba(0, 0, 0, 0.85);
  span {
    margin: 5px 0;
  }
}
.status {
  .dian {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
  }
}

.userInfo {
  margin-left: 10px;
  color: #333;
  img {
    position: relative;
    top: -2px;
    margin-right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 32px;
    background: #666;
    overflow: hidden;
  }
}

.logisticsInfoHd {
  margin-bottom: 20px;
}
</style>

<style>
.draw_overlay .ant-tooltip-inner {
  color: #333 !important;
  background-color: #fff !important;
}
.draw_overlay .ant-tooltip-arrow::before {
  background-color: #fff;
}

.ant-btn-link.disabled,
.ant-btn-link.disabled:hover {
  color: #999;
}
</style>
